package com.taobao.schedule.monitor;

import java.util.List;

import com.taobao.notify.msgcenter.PushMessage;

/**
 * 发送告警消息管理中心
 * 
 * @author Livis
 * 
 */
public class AlertMsgManager {

	private static PushMessage pushMessage;

	static {
		pushMessage = PushMessage.getInstance();
		pushMessage.setWangwangTitle("schedule-monitor");
	}

	/**
	 * 向一位用户发送告警信息
	 * 
	 * @param user
	 * @param msg
	 */
	public void alertByWW(String user, String msg) {
		if (user == null || msg == null) {
			return;
		}
		pushMessage.alertByWW(user, msg);
	}

	/**
	 * 向多位用户发送告警信息
	 * 
	 * @param users
	 * @param msg
	 */
	public void alertByWW(List<String> users, String msg) {
		if (users == null || msg == null) {
			return;
		}
		// 用户列表没有用户
		if (users.size() < 0) {
			return;
		}
		// 向每个用户发送告警信息
		for (String user : users) {
			pushMessage.alertByWW(user, msg);
		}
	}

	public void alertByMobile(String mobile, String msg) {
		if (mobile == null || msg == null) {
			return;
		}
		pushMessage.alertByMobile(mobile, msg);
	}

	public void alertByMobile(List<String> mobiles, String msg) {
		if (mobiles == null || msg == null) {
			return;
		}
		// 用户列表没有用户
		if (mobiles.size() < 0) {
			return;
		}
		// 向每个用户发送告警信息
		for (String mobile : mobiles) {
			pushMessage.alertByMobile(mobile, msg);
		}
	}

	public String getWwHost() {
		return pushMessage.getWangwangGatewayHost();
	}

	public void setWwHost(String wwHost) {
		pushMessage.setWangwangGatewayHost(wwHost);
	}

	public int getWwPort() {
		return pushMessage.getWangwangGatewayPort();
	}

	public void setWwPort(int wwport) {
		pushMessage.setWangwangGatewayPort(wwport);
	}

	public String getWwUrl() {
		return pushMessage.getWangwangGatewayURI();
	}

	public void setWwUrl(String wwUrl) {
		pushMessage.setWangwangGatewayURI(wwUrl);
	}

	public String getSmsHost() {
		return pushMessage.getSmsGatewayHost();
	}

	public void setSmsHost(String smsHost) {
		pushMessage.setSmsGatewayHost(smsHost);
	}

	public int getSmsPort() {
		return pushMessage.getSmsGatewayPort();
	}

	public void setSmsPort(int smsPort) {
		pushMessage.setSmsGatewayPort(smsPort);
	}

	public String getSmsUrl() {
		return pushMessage.getSmsGatewayURI();
	}

	public void setSmsUrl(String smsUrl) {
		pushMessage.setSmsGatewayURI(smsUrl);
	}
}
